A micro controller is a processor on a microchip that performs, for example, arithmetic and logic operations. A micro controller creates a task to perform a set of instructions. For example, a task may perform processing on a packet, which is a unit of data.
Packets are received and stored in memory in the order in which they were received in, for example, a First In First Out (FIFO) queue. One task is assigned to one packet and performs processing on the packet. During processing, the task generates commands that describe how the packet is to be transferred across a network. The task may write the commands into a FIFO queue in memory. Two tasks may share a single FIFO queue. At any given time, one task writes commands associated with a packet into the next available memory location in the queue. Because the tasks work on the packets in the order in which they were received and alternate when they will write into the FIFO queue, the result is that the commands for the packets are stored in the FIFO queue in the order in which the packets were received. Thus, the packets are transmitted in the order in which they were received.
Unfortunately, this technique requires that only two tasks work with a single FIFO queue. In a multi-tasking environment in which there are more than two tasks, multiple FIFO queues are used, with two tasks dedicated to each FIFO queue. This may result in a large number of FIFO queues, with associated overhead in maintaining the FIFO queues.